package com.qf.exc;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MyExceptionResolver implements HandlerExceptionResolver {
    @Override
    public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
        //打印异常堆栈信息到日志
        e.printStackTrace();
        ModelAndView modelAndView=new ModelAndView();
        //返回给用户的提示信息
        modelAndView.addObject("error","大哥不好意思，网络说他很忙");
        modelAndView.setViewName("error1");
        return modelAndView;



    }
}
